


<?PHP

	include("conectar.php");
	
	
	if ($_GET) {
		if ($_REQUEST['empresa'] != "") {
			$nombre_empresa = mysql_real_escape_string($_REQUEST['empresa']);
			mysql_query("INSERT INTO empresa (id_empresa,Empresa) VALUES('','$nombre_empresa')"); 
		}
	}
	
	$result = mysql_query ("SELECT * FROM empresa")
	
	
?>





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<title>PRIMERA PRUEBA</title>
</head>

<body>



<h1>Lista empresas</h1>
<table border="0" cellpadding="2" cellspacing="3" summary= "Lista de empresas introducidas">

<tr>
	<th> ID </th>
	<th> NOMBRE </th>
	
</tr>	



<?PHP
	while ($fila  = mysql_fetch_array ($result)) {
		echo "<tr>";
		echo "<td>".$fila['id_empresa']."</td>";
		echo "<td>".$fila['Empresa']."</td>";
		echo "</tr>";
	}
	mysql_free_result ($result);
	mysql_close();
?>

</table>

<form  method="get" target="_self">


<input name="empresa" type="text" maxlength="50" />

<input name="accion" type="submit" value= "proceder" />


</form>


</body>
</html>
